<?php
/**
 * Created By virus_cms
 * Author: Virus
 * Date: 2020/2/28
 * Time: 23:12
 */

namespace app\admin\validate;


use think\Validate;

class AdminValidate extends Validate
{
    protected $rule = [
        'id'       => 'require|number|integer',
        'username' => 'require',
        'password' => 'require',
        'status'   => 'require|number|integer',
    ];

    protected $message = [
        'username'       => '用户名必须',
        'password'       => '密码必须',
        'status.require' => '状态值必须',
        'status.number'  => '状态值为数字',
        'status.integer' => '状态值为整型',
        'id.require'     => '管理员id必须',
        'id.number'      => '管理员id为数字',
        'id.integer'     => '管理员id为整型',
    ];

    protected $scene = [
        'login' => ['username', 'password'],
        'add'   => ['username', 'password', 'status'],
        'edit'  => ['username', 'id'],
    ];
}